//
//  KSKAKatsudouCell.m
//  DashboardHD
//
//  Created by 楊亜玲 on 17/4/11.
//  Copyright © 2017年 Totyu. All rights reserved.
//

#import "KSKAKatsudouCell.h"
#import "KSKALineChart.h"

@interface KSKAKatsudouCell ()


@end

@implementation KSKAKatsudouCell


-(void)setKatsudou:(KSKAKatsudouResult *)katsudou{
    _katsudou = katsudou;
    
    self.eventLabel.text = _katsudou.actionname;
    self.colorImageView.backgroundColor = [UIColor colorWithHex:_katsudou.actioncolor];
    self.chartView.backgroundColor = [UIColor yellowColor];
    // 显示图表
    [self setupChart];
}


-(void)setupChart{
    eventType type;
    // 温度、湿度
    if ([_katsudou.actionid isEqualToString:@"環境1"] || [_katsudou.actionid isEqualToString:@"環境2"]) {
        type = eventTypeEviroment;
    // 活動
    }else{
        type = eventTypeAction;
    }
    KSKALineChart *chart = [[KSKALineChart alloc]initWithFrame:self.chartView.bounds dataSource:_katsudou eventType:type];
    [self.chartView addSubview:chart];
    
}


@end
